﻿using System;
using System.Collections.Generic;
using MessageTypeDescriber.Xml;
using NUnit.Framework;

namespace MessageTypeDescriber.Tests.SignatureTests
{
    [TestFixture]
    class TypeSignature
    {
        [Test]
        public void can_generate_object_signature_properly()
        {
            TypeDescription typeDescription = new TypeDescription(typeof(Object));

            const string expected = "Object";

            String observed = typeDescription.Signature;

            Assert.AreEqual(expected, observed);

        }

        [Test]
        public void can_generate_int_signature_properly()
        {
            TypeDescription typeDescription = new TypeDescription(typeof(int));

            const string expected = "Int32";

            String observed = typeDescription.Signature;

            Assert.AreEqual(expected, observed);

        }

        [Test]
        public void can_generate_list_signature_properly()
        {
            TypeDescription typeDescription = new TypeDescription(typeof(List));

            const string expected = "List";

            String observed = typeDescription.Signature;

            Assert.AreEqual(expected, observed);

        }

        [Test]
        public void can_generate_generic_type_signature_properly()
        {
            TypeDescription typeDescription = new TypeDescription(typeof(List<int>));

            const string expected = "List<Int32>";

            String observed = typeDescription.Signature;

            Assert.AreEqual(expected, observed);

        }  
        
        [Test]
        public void can_generate_generic_interface_type_signature_properly()
        {
            TypeDescription typeDescription = new TypeDescription(typeof(IList<int>));

            const string expected = "IList<Int32>";

            String observed = typeDescription.Signature;

            Assert.AreEqual(expected, observed);

        }

        [Test]
        public void can_generate_generic_complex_type_signature_properly()
        {
            TypeDescription typeDescription = new TypeDescription(typeof(Dictionary<IList<int>,List<string>>));

            const string expected = "Dictionary<IList<Int32>, List<String>>";

            String observed = typeDescription.Signature;

            Assert.AreEqual(expected, observed);

        }
    }
}